package org.dromara.community.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.community.entity.AsUserActivity;
import org.dromara.community.entity.dto.AsUserActivityDTO;

import java.util.List;

@Mapper
public interface AsUserActivityMapper extends BaseMapper<AsUserActivity> {

    @Select("SELECT\n" +
        "\tu.id,\n" +
        "\tu.user_id,\n" +
        "\tu.as_activity_id,\n" +
        "\tu.state,\n" +
        "\ts.nick_name,\n" +
        "\tac.activity_name,\n" +
        "\tac.address,\n" +
        "\tac.activities_img,\n" +
        "\tac.registration_start_time \n" +
        "FROM\n" +
        "\tas_user_activity u\n" +
        "\tLEFT JOIN sys_user s ON u.user_id = s.user_id\n" +
        "\tLEFT JOIN as_activity ac ON u.as_activity_id = ac.id \n" +
        "\tWHERE u.state = 0")
    List<AsUserActivityDTO> selectAsUserActivityAll(AsUserActivityDTO asUserActivityDTO);

}
